"""
一个回合制游戏，有两个英雄分别已两个类进行定义。分别是EZ和JINX
每个英雄都有hp属性和power属性，分别代表血量和攻击力
JINX： hp:1000 power,210
EZ: hp,1100 power,190
每个英雄都有一个fight方法：
hero_final_hp = hero_hp-enemy_power
enemy_final_hp = enemy_hp-hero_power
对比hero_final_hp和enemy_final_hp
"""


class Hero:
    hp = 0
    power = 0
    hero_name = ""

    # def __init__(self, hp, power):
    #     """
    #
    #     :param hp: 血量
    #     :param power: 攻击力
    #     """
    #
    #     self.hp = hp
    #     self.power = power
    #     print("调用构造方法！")

    def fight(self, enemy_power, enemy_hp, enemy_name):
        """

        :param enemy_power: 对方攻击力
        :param enemy_hp: 对方血量
        :return:
        """
        hero_final = self.hp - enemy_power
        enemy_final = enemy_hp - self.power
        if hero_final > enemy_final:
            print(f"{enemy_name}输了")
        elif hero_final == enemy_final:
            print(f"{enemy_name}与{self.hero_name}打平")
        else:
            print(f"{self.hero_name}赢了")
# Hero().fight(200,20) 当类中已经定义构造方法后，则创建对象传参数时，必须要按照构造参数的进行传递才能够创建对象，否则会报错。